#include <head.h>

int main(int argc, char const *argv[])
{
    // 打开管道
    FILE *fp_1 = popen("ls -l", "r");
    FILE *fp_2 = fopen("test.txt", "a+");
    if (fp_1 == NULL)
    {
        ERRLOG("管道打开失败\n");
    }
    if (fp_2 == NULL)
    {
        ERRLOG("文件打开失败\n");
    }
    // 从文件中读取出来
    char ch = 0;
    while (EOF != (ch = getc(fp_1)))
    {
        putc(ch , fp_2);
    }
    
    return 0;
}